# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SetAclRequest do
  @moduledoc """
  Request message for DocumentService.SetAcl.

  ## Attributes

  *   `policy` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleIamV1Policy.t`, *default:* `nil`) - Required. REQUIRED: The complete policy to be applied to the `resource`. The size of the policy is limited to a few 10s of KB. This refers to an Identity and Access (IAM) policy, which specifies access controls for the Document. You can set ACL with condition for projects only. Supported operators are: `=`, `!=`, `<`, `<=`, `>`, and `>=` where the left of the operator is `DocumentSchemaId` or property name and the right of the operator is a number or a quoted string. You must escape backslash (\\\\) and quote (\\") characters. Boolean expressions (AND/OR) are supported up to 3 levels of nesting (for example, "((A AND B AND C) OR D) AND E"), a maximum of 10 comparisons are allowed in the expression. The expression must be < 6000 bytes in length. Sample condition: `"DocumentSchemaId = \\"some schema id\\" OR SchemaId.floatPropertyName >= 10"`
  *   `projectOwner` (*type:* `boolean()`, *default:* `nil`) - For Set Project ACL only. Authorization check for end user will be ignored when project_owner=true.
  *   `requestMetadata` (*type:* `GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1RequestMetadata.t`, *default:* `nil`) - The meta information collected about the end user, used to enforce access control for the service.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :policy => GoogleApi.ContentWarehouse.V1.Model.GoogleIamV1Policy.t() | nil,
          :projectOwner => boolean() | nil,
          :requestMetadata =>
            GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1RequestMetadata.t()
            | nil
        }

  field(:policy, as: GoogleApi.ContentWarehouse.V1.Model.GoogleIamV1Policy)
  field(:projectOwner)

  field(:requestMetadata,
    as: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1RequestMetadata
  )
end

defimpl Poison.Decoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SetAclRequest do
  def decode(value, options) do
    GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SetAclRequest.decode(
      value,
      options
    )
  end
end

defimpl Poison.Encoder,
  for: GoogleApi.ContentWarehouse.V1.Model.GoogleCloudContentwarehouseV1SetAclRequest do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
